package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.SignUpRoomPrice;
import com.eling.elcms.travel.service.ISignUpRoomPriceManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@Controller
public class SignUpRoomPriceController extends BaseFormController{
	@Autowired
	private ISignUpRoomPriceManager signUpRoomPriceManager;
	
	@RequestMapping("/api/signuproomprice/save")
    @ResponseBody
	public SignUpRoomPrice save(@ModelAttribute@ModelFilling SignUpRoomPrice signUp){
		return signUpRoomPriceManager.save(signUp);
	}
	
	@RequestMapping("/api/signuproomprice/query")
    @ResponseBody
	public List<SignUpRoomPrice> query(@ModelAttribute SignUpRoomPrice signUp){
		return signUpRoomPriceManager.query(signUp);
	}
	
	@RequestMapping("/api/signuproomprice/search*")
	@ResponseBody
	public List<SignUpRoomPrice> search(@ModelAttribute SearchCondition sc,@ModelAttribute SignUpRoomPrice signUp){
		sc.setQueryCondition(signUp);
		return signUpRoomPriceManager.search(sc);
	}
	
	@RequestMapping("/api/signuproomprice/{pkSignUpRoomPrice}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkSignUpRoomPrice){
		signUpRoomPriceManager.remove(pkSignUpRoomPrice);
		return new Msg("删除成功");
	}
	
}
